<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	<title>Insert title here</title>
	
	<%@ include file="../jsp/shared/header.jsp" %>
	
	<link rel="stylesheet" type="text/css" href="<%=scriptPageContext %>/static/styles/semantic.css">
	<link rel="stylesheet" type="text/css" href="<%=scriptPageContext %>/static/styles/survey.css">
	
	<script language="JavaScript" src="<%=scriptPageContext %>/static/js/libs/swfobject/2.2/swfobject.js"></script>
	<script language="JavaScript" src="<%=scriptPageContext %>/static/js/scriptcam.js"></script>
	
	<script>
		$(document).ready(function() {
		    $("#webcam").scriptcam({
		    	readBarCodes:'CODE_128,QR_CODE'
		    });
		});
		
		function getBarCode(){
			var barCode = $.scriptcam.getBarCode();
			if(barCode){
				redirect('survey/' + barCode);
			}
		}
		
		setInterval(getBarCode, 1000);
	</script>
</head>
<body>
	<div class="bgSurvey">
		<img src="<%=scriptPageContext %>/static/img/bgQR.jpg">
		<div class="content">
			<h1>Acerca tu credencial a la camara</h1>
			<div class="ui center aligned segment webcam">
				<div id="webcam" style="width: 500px; height: 250px"></div>
			</div>
		</div>
	</div>
</body>
</html>